home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_11 / phillip2 / create.c < prev    next >
C/C++ Source or Header  |  1993-06-25  |  1KB  |  56 lines

  1.  
  2.  
  3.    /************************************************
  4.    *
  5.    *       file d:\cips\create.c
  6.    *
  7.    *       Functions: This file contains
  8.    *           main
  9.    *
  10.    *       Purpose:
  11.    *          This program creates an 8 bit tiff file
  12.    *          of size l*ROWS by w*COLS.
  13.    *
  14.    *       External Calls:
  15.    *          wtiff.c - create_allocate_tiff_file
  16.    *
  17.    *       Modifications:
  18.    *          7 Arpil 1992 - created
  19.    *
  20.    *************************************************/
  21.  
  22. #include "cips.h"
  23.  
  24. short image[ROWS][COLS];
  25.  
  26. main(argc, argv)
  27.    int  argc;
  28.    char *argv[];
  29. {
  30.    int    l, w;
  31.    struct tiff_header_struct image_header;
  32.  
  33.    if(argc < 4 || argc > 4){
  34.       printf(
  35.       "\nusage: create file-name length width\n"
  36.       "\n       the program will multiply length "
  37.       "and width"
  38.       "\n       by %d and %d", ROWS, COLS);
  39.       exit(-1);
  40.    }
  41.  
  42.    l = atoi(argv[2]);
  43.    w = atoi(argv[3]);
  44.  
  45.    image_header.lsb            = 1;
  46.    image_header.bits_per_pixel = 8;
  47.    image_header.image_length   = l*ROWS;
  48.    image_header.image_width    = w*COLS;;
  49.    image_header.strip_offset   = 1000;
  50.  
  51.    create_allocate_tiff_file(argv[1], 
  52.                              &image_header, 
  53.                              image);
  54.  
  55. }
  56.